require('../../assets/css/index.js')
require('../../assets/fonts/font/iconfont.css')
require('../../assets/lib/swiper/swiper-bundle.css')
let Swiper = require('../../assets/lib/swiper/swiper-bundle.js')
require('../../utils/local.js')
let https = require('../../utils/https.js')

// 引入公共js
let dom = require('../../utils/dom.js')
const local = require('../../utils/local.js')
require('./circle.less')
// 当前页面js
dom.isLogin()
dom.ready(function () {
  dom.bMenu('circle')
  let localData = local.get('rec');
  
  dom.getEle('.name').innerHTML = localData[0].name;
  dom.getEle('.rec').innerHTML = localData[0].desc;
  console.log(localData[0].imgUrl);
  dom.getEle('.pic').src = https.hostUrl + localData[0].imgurl;
  dom.getEle('.add').addEventListener("click",function(){
    window.location.href='circleAdd.html'
  })
  function getCircle() {
    https.get('/api/circles/opinionList', {}, (res) => {
      if (res.errno == 0) {

        console.log(res);
       
          res.data.map((v,i)=>{
            console.log(111);  //拿到了
            
            dom.getEle(".person").innerHTML+=`
            <li class="user">
            <div class="neighborhood fdrow">
           <div class="head"></div>
            <div>
              <h5 class="userName">${v.id}</h5>
              <p class="area">xx省,xx市</p>
          </div>
    
          </div>
          <p class="mood">
          ${v.content}
          </p>
          <ul class="pics fdrow jbetwen" id="fripic${i}">
            
           
          </ul>
    
          <h4>4小时前</h4></li>`;
          v.imgUrls.map(function(v){
            console.log(https.hostUrl+v);
            dom.getEle(`#fripic${i}`).innerHTML+=`
            <li><img src="${https.hostUrl+v}" alt=""></li>`
          })
          
          

          })

        }
    })
  }
  getCircle()

})